#!/bin/bash

function start_project()
{
        source /etc/profile
        echo "切换路径：/var/lib/jenkins/workspace/springboot3"
        cd /var/lib/jenkins/workspace/springboot3
        echo "--------------------"
        echo "正在启动项目"
        docker stop springboot3demo
        docker rm springboot3demo
        docker rmi springboot3
        docker build -t springboot3:v1.0 -f Dockerfile .
        docker run -d -p 8888:8888 -e ENV=dev1 -e DEV=dev1 --name springboot3demo springboot3:v1.0
        sleep 10s
        echo "--------------------"

}

start_project